home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7301 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  61 lines

  1. Path: red5.cac.washington.edu!atb
  2. From: "Aaron T. Baldie" <atb@cac.washington.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: HELP! Please! Why doesn't this work
  5. Date: Thu, 15 Feb 1996 13:37:48 -0800
  6. Organization: University of Washington
  7. Message-ID: <Pine.ULT.3.91a.960215131933.614A-100000@red5.cac.washington.edu>
  8. NNTP-Posting-Host: red5.cac.washington.edu
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11.  
  12. #include <stdio.h>
  13. #include <malloc.h>
  14.  
  15. [=>/***************************************************************/
  16. [=>void initialize_array(char **solution, int size){
  17. [=>   int row, col;
  18. [=>   for(row = 0; row < size; row++){
  19. [=>      for(col = 0; col < size; col++){
  20. [=>         solution[row][col] = 'w';
  21. [=>      }
  22. [=>   }
  23. [=> 
  24. [=>}
  25. [=> 
  26. [=>/***************************************************************/
  27. void print_maze(char **maze, int size){
  28. int row, col;
  29.  
  30. for (row = 0; (row<size); row++){
  31.   for (col = 0; (col<size); col++){
  32.         printf("%c", maze[row][col]);
  33.   }
  34.         printf("\n");
  35. }
  36. }
  37.  
  38. /***************************************************************/
  39. main()
  40. {
  41.   char **solution_array;
  42.   int size, row, col;
  43.   size = 20;
  44.     solution_array = (char **) malloc(size);                
  45.       for (row=0; row<size; row++){
  46.        solution_array[row] = (char *) malloc(size);
  47.       }
  48.     
  49.     initialize_array(solution_array, size);  
  50.     print_maze(solution_array, size)
  51. }
  52.  
  53.  
  54. Aaron Baldie                 
  55. atb@u.washington.edu                                   
  56. http://weber.u.washington.edu/~atb/                                 
  57. (206)543-5970      
  58.  
  59.  
  60.  
  61.